package com.example.mapper;

import com.example.domain.ZoneDevice;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ZoneDeviceMapper {

    @Select("select * from wmy.zone_device")
    List<ZoneDevice> getAll();

    @Select("select * from wmy.zone_device where zone_id = #{zoneId}")
    ZoneDevice getById(Integer zoneId);

    @Insert("insert into wmy.zone_device (zone_id, device_id) values (#{zoneId}, #{deviceId})")
    boolean add(ZoneDevice zoneDevice);

    @Update("update wmy.zone_device set zone_id=#{zoneId},device_id=#{deviceId} where zone_id = #{zoneId}")
    boolean update(ZoneDevice zoneDevice);

    @Delete("delete from wmy.zone_device where zone_id = #{zoneId}")
    boolean delete(Integer zoneId);

}
